﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;

namespace provider.Controllers
{
    [ApiController]
    [Route("[controller]")]
    public class ValuesController : ControllerBase
    {

        private readonly ILogger<ValuesController> _logger;

        public ValuesController(ILogger<ValuesController> logger)
        {
            _logger = logger;
        }

        [HttpGet]
        public IEnumerable<String> Get([FromServices] IHostEnvironment env)
        {
            var ip = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
            var ipstrs = ip.Select(x => x.ToString());
            //var ip = System.Net.IPAddress.;
            return new List<string>() { "provider", env.EnvironmentName, ipstrs.Aggregate((x, y) => x + "," + y) };
        }

    }
}
